]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
app-system: Add back StartupWMClass matching
authorJasper St. Pierre <jstpierre@mecheye.net>
Thu, 26 Sep 2013 21:19:21 +0000 (17:19 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Thu, 7 Nov 2013 21:35:03 +0000 (16:35 -0500)
While unfortunate that we still have to scan all apps with get_all(),
support for this feature will be short-lived, so hopefully we can drop
it in the future as new apps adapt to the desktop file / app ID
recommendations.

For now, simply scan all desktop IDs.

https://bugzilla.gnome.org/show_bug.cgi?id=711631

src/shell-app-system.c

index d9c57e0fbcb1cf4e4c4835df27f29c6eb9b86873..feca09cf86200f700e8cdd99cccaed69c424ee80 100644 (file)
@@ -71,12 +71,37 @@ static void shell_app_system_class_init(ShellAppSystemClass *klass)
   g_type_class_add_private (gobject_class, sizeof (ShellAppSystemPrivate));
 }
 
+static void
+scan_startup_wm_class_to_id (ShellAppSystem *self)
+{
+  ShellAppSystemPrivate *priv = self->priv;
+  GList *apps, *l;
+
+  g_hash_table_remove_all (priv->startup_wm_class_to_id);
+
+  apps = g_app_info_get_all ();
+  for (l = apps; l != NULL; l = l->next)
+    {
+      GAppInfo *info = l->data;
+      const char *startup_wm_class, *id;
+
+      id = g_app_info_get_id (info);
+      startup_wm_class = g_desktop_app_info_get_startup_wm_class (G_DESKTOP_APP_INFO (info));
+      if (startup_wm_class != NULL)
+        g_hash_table_insert (priv->startup_wm_class_to_id, (char *) startup_wm_class, (char *) id);
+    }
+
+  g_list_free_full (apps, g_object_unref);
+}
+
 static void
 installed_changed (GAppInfoMonitor *monitor,
                    gpointer         user_data)
 {
   ShellAppSystem *self = user_data;
 
+  scan_startup_wm_class_to_id (self);
+
   g_signal_emit (self, signals[INSTALLED_CHANGED], 0, NULL);
 }